package com.demo.swagger.controller;

import com.demo.swagger.entity.Classes;
import com.demo.swagger.service.ClassesService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * (Classes)表控制层
 *
 * @author makejava
 * @since 2019-05-10 19:33:06
 */
@Api(description = "班级接口")
@RestController
@RequestMapping("/classes")
public class ClassesController {
    /**
     * 服务对象
     */
    @Resource
    private ClassesService classesService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation(value = "获取班级信息",notes = "根据ID获取班级的基本信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query",name = "id",dataType = "String",required = true,value = "班级id")
    })
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功"),
            @ApiResponse(code=400,message = "参数不正确"),
            @ApiResponse(code = 404,message = "请求路径不正确")
    })
    @GetMapping("/selectOne")
    public Classes selectOne(Integer id) {
        return this.classesService.queryById(id);
    }

}